<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script src="./node_modules/vue/dist/vue.js"></script>
    <div id="app">
        <button @click="show=!show">渐变过渡</button>
        <transition name="lyr">
            <p v-show="show">liyiruo</p>
        </transition>
    </div>

    <div id="app2">
        <button @click="show=!show">渐变横滑过渡</button>
        <transition name="li">
            <p v-show="show">liyiruo</p>
        </transition>
    </div>
</body>
<script>
    new Vue({
        el: "#app",
        data: {
            show: true
        }
    })


    new Vue({
        el: "#app2",
        data: {
            show: true
        }
    })
</script>

<style>
    .lyr-enter-action,.lyr-leave-active{
        transition: opacity 1s;/*过渡：渐变效果持续时长1秒*/
    }
    .lyr-enter,.lyr-leave-to{
        opacity: 0s;
    }

.li-enter-active{
    transition: all 1s;/* 所有效果持续1秒 */
}
.li-leave-active{
    transition:all 5s;
}
/* 显示前或隐藏后的效果 */
.ly-enter,.li-leave-to{
    opacity: 0;
    transform:translateX(100px)
}
</style>
</html>